package com.hendraanggrian.appcompat.widget;


/**
 * Simple optional hashtag data class, use when there is no custom hashtag class.
 */
public class Hashtag implements Hashtagable {
    private final CharSequence id;
    private final int count;

    /**
     * 构造函数
     *
     * @param hashtag 内容
     */
    public Hashtag(CharSequence hashtag) {
        this(hashtag, -1);
    }

    /**
     * 构造函数
     *
     * @param hashtag 内容
     * @param count 数量
     */
    public Hashtag(CharSequence hashtag, int count) {
        this.id = hashtag;
        this.count = count;
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof Hashtag && ((Hashtag) obj).id == id;
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public String toString() {
        return id.toString();
    }

    @Override
    public CharSequence getId() {
        return id;
    }

    @Override
    public int getCount() {
        return count;
    }
}